package com.likan.chqjtgc.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;

import java.io.Serializable;
import java.util.Collection;

/**
 * 增强版用户授权成功后存储的信息
 * @author lxh
 */
public class AuthUserVO extends org.springframework.security.core.userdetails.User implements Serializable {

    private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;

    /**
     * 用户ID
     */
    @JsonSerialize(using=ToStringSerializer.class)
    private Long id;

    /**
     * 用户名称
     */
    private String name;

    /**
     * 所在部门
     */
    private Long deptId;

    public AuthUserVO(String username, String password, Collection<? extends GrantedAuthority> authorities, Long id, String name, Long deptId) {
        super(username, password, authorities);
        this.id = id;
        this.name = name;
        this.deptId = deptId;
    }

    public AuthUserVO(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities, Long id, String name, Long deptId) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.id = id;
        this.name = name;
        this.deptId = deptId;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
